#include<bits/stdc++.h>
#define ll long long
#define stdin stdin
#define stdout stdout
using namespace std;
int n,x;
priority_queue<int>pq;
queue<int>q;
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%d",&x);
        pq.push(-x);
    }
    for(int i=1;i<=n;i++){
        x=pq.top();
        pq.pop();
        q.push(x);
        if(x<q.front()) q.pop();
    }
    printf("%ld",q.size());
    return 0;
}
